package main

import (
	"fmt"
	"math/rand"
)

var matename []string

func selectname(key string) []string {
	if key == "q" || matename == nil {
		return nil
	}
	num := rand.Intn(len(matename))
	fmt.Println("本次抽取到的同学是：", matename[num])
	matename = append(matename[:num], matename[num+1:]...)
	return matename
}

func main() {
	matename = []string{"陈颢元", "彭昊", "王子怡", "谢杨帆", "谭嗣桥", "朱磊", "老李"}
loop:

	fmt.Println("请按任意键进行抽取，按q退出")
	var key1 string
	fmt.Scanln(&key1)
	remainname := selectname(key1)
	if remainname == nil {
		goto loopend
	} else {
		fmt.Println("剩余还未抽过的同学是：", remainname)
		goto loop
	}
loopend:
}
